<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {margin: 0;overflow: hidden;}
    #canvas {background-color: antiquewhite;}
  </style>
</head>
<body>
  <canvas id="canvas"></canvas>
  <script>
    /** @type {HTMLCanvasElement} */
    const canvas = document.querySelector('#canvas');
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;
    const ctx = canvas.getContext('2d');
    ctx.lineWidth = 40;

    /* 描边的着色样式 */
    ctx.strokeStyle = 'maroon';
    /*
      lineJoin描边拐角样式
      * miter
      * round
      * bevel
    */
    ctx.save();
    ctx.beginPath();
    ctx.moveTo(50,50);
    ctx.lineTo(400,50);
    ctx.lineTo(200,150);
    ctx.lineJoin = 'miter';
    ctx.miterLimit = 1; // 若拐角过小
    ctx.stroke();
    ctx.restore();

    ctx.save();
    ctx.beginPath();
    ctx.moveTo(50,250);
    ctx.lineTo(400,250);
    ctx.lineTo(200,350);
    ctx.lineJoin = 'round';
    ctx.stroke();
    ctx.restore();

    ctx.save();
    ctx.beginPath();
    ctx.moveTo(50,450);
    ctx.lineTo(400,450);
    ctx.lineTo(200,550);
    ctx.lineJoin = 'bevel';
    ctx.stroke();
    ctx.restore();

  </script>
</body>
</html>